<?php

namespace Modules\Admin\Http\Controllers;

use Illuminate\Support\Facades\Request;
use Modules\Admin\Service\CheckpointTypeService;

class CheckpointTypeController extends BaseController
{
    /**
     * 检测机构类型列表
     */
    public function index()
    {
        $data = Request::input();
        $list = CheckpointTypeService::checkpointList($data);

        echo_error($list);
        return view('admin::checkpointType.index', ['list' => $list, 'data' => $data]);
    }

    /**
     * 添加
     */
    public function create()
    {
        return view('admin::checkpointType.create');
    }

    /**
     * 添加
     */
    public function store()
    {
        $arrInput = Request::all();
        return CheckpointTypeService::addOne((array)$arrInput);
    }

    /**
     * 编辑
     */
    public function edit()
    {
        $id = (int)Request::get('id', 0);
        $data = CheckpointTypeService::getOne((int)$id);

        return view('admin::checkpointType.edit', ['data' => $data]);
    }

    /**
     * 编辑
     */
    public function update()
    {
        $arrInput = Request::all();
        return CheckpointTypeService::editOne((array)$arrInput);
    }


    /**
     * 删除
     */
    public function del()
    {
        $data = (int)Request::get('id', 0);
        return CheckpointTypeService::del($data);
    }
}
